import java.util.Scanner;

//主类和主函数的演示
public class project2 {
    //main方法
    public static void main(String[] args){


        System.out.println("请输入数组最大位数：");
        Scanner length = new Scanner(System.in);
        int  n= length.nextInt();
        int[] a = new int [n];
        int[] sum = new int[100];
        int z=0;
        System.out.println("请输入"+n+"个整数:");
        for(int i = 0;i<n;i++){
            Scanner x = new Scanner(System.in);
            a[i] =x.nextInt();
        }
        for(int i = 0;i<n-1;i++){
            for(int m=i+1;m<n;m++){
                sum[z++]=a[i]+a[m];
            }
        }
        int max=0;
        for(int x=0;x<sum.length;x++){
            if(max<sum[x]) {
                max = sum[x];
            }

        }
        System.out.println("该数组中子数组之和的最大值为："+max);
    }
}
